﻿using Client.Processes;
using Client.ViewModels;

namespace Client.Commands
{
    public class EditMovieCommand : BaseCommand
    {
        private ReadMovie load;

        public EditMovieCommand(ReadMovie load)
        {
            this.load = load;
        }
        public override bool CanExecute(object parameter)
        {
            var viewModel = (parameter as WorkspaceViewModel);

            if (viewModel == null)
                return false;

            return !viewModel.IsEditMode && viewModel.MovieItem != null && !viewModel.IsListView;
        }

        public override void Execute(object parameter)
        {
            var viewModel = (parameter as WorkspaceViewModel);
            load.Process(viewModel.MovieItem.Id);
        }
    }
}
